<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<title>审核列表(平台)</title>
	<link rel="stylesheet" type="text/css" href="/manager/easyui/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="/manager/easyui/themes/icon.css">
	<script type="text/javascript" src="/manager/easyui/jquery.min.js"></script>
	<script type="text/javascript" src="/manager/easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript">
        //工具栏
        var toolbar = [{
            text: '审核',
            iconCls: 'icon-edit',
            handler: function () {
                $('#dd').dialog('open');
            }
        }];
        $(function(){
            //初始化搜索下拉框
            $('#search_type').combobox({
                prompt:"--请选择出版商--",
                url:"/manager/supplier/findAll",
                valueField:'id',
                multiple: false,
                textField:'name',
                editable:true
            });

            //展示所有查询列表
            $('#booklist').datagrid({
                title:'审核列表',
                iconCls:'icon-save',
                url:'/manager/examine/findExamineByFuzzy',
                columns:[
                    [
                        {field:'title',title:'审核标题',width:100,align:'center'},
                        {field:'flag',title:'审核状态',width:80,align:'center',formatter:function (value) {
                                let str = '';
                                if(0==value){
                                    str = '待审核';
                                }
                                if(1==value){
                                    str = '审核已通过';
                                }
                                if(2==value){
                                    str = '审核未通过';
                                }
                                return str;
                            }},
                        {field:'info',title:'审核详情',width:200,align:'center'},
                        {field:'e',title:'书籍详情',width:200,align:'center',formatter:function(value,row,index){
                                return "<a href=''>查看</a>";
                            }}
                    ]
                ],
                toolbar: toolbar,
                pagination: true,//表示在datagrid设置分页
                pageSize: 5,
                singleSelect:true,
                pageList: [5,10,20]
            });

            //模糊查询审核列表
            $('#searchExamine').click(function () {
                $('#booklist').datagrid("load", {
                    bookname: $("input[name='bookname']").val(),
                    ISBN: $("input[name='ISBN']").val(),
                    supplierid: $("#searchType").val()
                });
            });

            //初始化查询栏
            $("#submit_search").linkbutton({ iconCls: 'icon-search', plain: true })
                .click(function () {
                    $('#dg').datagrid({ queryParams: form2Json("searchform") });   //点击搜索
                });

            //初始化修改窗口
            $('#dd').dialog({
                title: 'My Dialog',
                width: 700,
                height: 500,
                closed: true,
                cache: false,
                href: '',
                modal: true,
                iconCls: 'icon-save',
                buttons: [{
                    text:'提交',
                    iconCls:'icon-ok',
                    handler:function(){
                        var row = $('#booklist').datagrid('getSelected');
                        $.ajax({
                            type:'post',
                            url:'/manager/book/executeExamine',
                            data:{
                                "flag":$('#search_type').val(),
                                "info":$('#examine_info').val(),
                                "id":row.id,
                                "bookid":row.bookid,
                                "number":row.number,
                                "supplierid":row.supplierid
                            },
                            dataType:'json',
                            success:function (data) {
                                if(data.status){
                                    alert(data.msg);
                                    location.reload();
                                }else {
                                    alert(data.msg);
                                    location.reload();
                                }
                            }
                        });
                    }
                },{
                    text:'关闭',
                    handler:function(){
                        alert('cancel');;
                    }
                }]
            });


        });
	</script>
</head>
<body>
<form name="searchform" method="post" action="" id ="searchform">
	<td width="70" height="30"><strong>审核查询：</strong></td>
	<td height="30">
		<input type="text" name="bookname" size=20 placeholder="书籍名称"/>
		<input type="text" name="ISBN" size=20 placeholder="ISBN"/>
		<input type="text" name="search_type" id="search_type"/>
	</td>
	<td>
		<button id="searchExamine" type="button">查询</button>
	</td>
</form>
<table id="booklist"></table>
<div id="dd">
	<div align="center" style="margin-top: 30px">
		<form id="ff">
			<table>
				<tr>
					<td>
						审核状态:
					</td>
					<td>
						<select name="search_type" id="searchType" style="width:100px">
							<option value="1">通过</option>
							<option value="2">不通过</option>
						</select>
					</td>
				</tr>
				<tr style="vertical-align:top">
					<td>
						审核详情:
					</td>
					<td>
						<textarea id="examine_info" rows="10" cols="30"></textarea>
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>
</body>
</html>